package com.longdaji.decoration.ui.activitiesOfMine.setting;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.longdaji.decoration.R;
import com.longdaji.decoration.base.BaseActivity;
import com.longdaji.decoration.ui.activitiesOfMine.accountManagement.AccountManagementActivity;
import com.longdaji.decoration.ui.activitiesOfMine.personData.PersonalDataActivity;
import com.longdaji.decoration.ui.main.MainActivity;
import com.longdaji.decoration.ui.shippingaddr.ShippingAddrActivity;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SettingActivity extends BaseActivity implements SettingContract.View {

    @Inject
    SettingContract.Presenter mPresenter;

    @BindView(R.id.tv_tool_title)
    TextView tvTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        setUnBinder(ButterKnife.bind(this));
        if (mPresenter != null)
            mPresenter.setView(this);
        tvTitle.setText("设置");

    }

    @OnClick({R.id.rl_tool_back, R.id.rl_personal_data, R.id.rl_account_manage, R.id.rl_receiving_address,
            R.id.btn_logout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_tool_back:
                finish();
                break;
            case R.id.rl_personal_data:
                startActivity(new Intent(this, PersonalDataActivity.class));
                break;
            case R.id.rl_account_manage:
                startActivity(new Intent(this, AccountManagementActivity.class));
                break;
            case R.id.rl_receiving_address:
                startActivity(new Intent(this, ShippingAddrActivity.class));
                break;
            case R.id.btn_logout:
                MainActivity.logout(this, true);
            default:
                break;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mPresenter != null)
            mPresenter.detachView();
    }

}
